/*
 * Copyright
 */
package org.apache.ibatis.transaction;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * 类描述
 *
 * @author ztkool
 * @since 1.0.0
 */
public interface Transaction {

    /**
     * 获取数据库连接
     *
     * @return
     * @throws SQLException
     */
    Connection getConnection() throws SQLException;

    /**
     * 事务提交
     *
     * @throws SQLException
     */
    void commit() throws SQLException;

    /**
     * 事务回滚
     *
     * @throws SQLException
     */
    void rollback() throws SQLException;

    /**
     * 关闭连接
     *
     * @throws SQLException
     */
    void close() throws SQLException;

    /**
     * 获取事务超时时间（如果有设置）
     *
     * @return
     * @throws SQLException
     */
    Integer getTimeout() throws SQLException;

}
